<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>find</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : April 1993</div>
    <p>
      <b>find</b> -  find indices of  boolean vector or matrix true elements</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[ii]=find(x [,nmax])  </tt>
      </dd>
      <dd>
        <tt>[i1,i2,..]=find(x [,nmax])  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>x</b>
        </tt>: may be a boolean vector,  a boolean matrix, a boolean
  hypermatrix, a "standard" matrix or hypermatrix</li>
      <li>
        <tt>
          <b>nmax</b>
        </tt>: an integer giving the maximum number of indices to return. The default value is -1 which stands for "all". This option can be used for efficiency, to avoid searching all indices.</li>
      <li>
        <tt>
          <b>ii, i1, i2, ..  </b>
        </tt>: integer vectors of indices or empty matrices</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    If <tt>
        <b>x</b>
      </tt> is a boolean matrix,</p>
    <p>
      <tt>
        <b>ii=find(x)</b>
      </tt> returns the vector
    of indices <tt>
        <b>i</b>
      </tt> for which <tt>
        <b>x(i)</b>
      </tt> is "true". If no true element
    found find returns an empty matrix.</p>
    <p>
      <tt>
        <b>[i1,i2,..]=find(x)</b>
      </tt> returns vectors of indices <tt>
        <b>i1</b>
      </tt> (for rows) and <tt>
        <b>i2</b>
      </tt> (for columns),..
    such that <tt>
        <b>x(i1(n),i2(n),..)</b>
      </tt> is "true". If no true element
    found find returns  empty matrices in <tt>
        <b>i1</b>
      </tt>,
    <tt>
        <b>i2</b>
      </tt>, ...</p>
    <p>
    if <tt>
        <b>x</b>
      </tt> is a standard matrix or hypermatrix <tt>
        <b>find(x)</b>
      </tt> is interpreted as
    <tt>
        <b>find(x&lt;&gt;0)</b>
      </tt>
    </p>
    <p>
      <tt>
        <b>find([])</b>
      </tt> returns <tt>
        <b>[]</b>
      </tt>
    </p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

A=rand(1,20);
w=find(A&lt;0.4)
A(w)
w=find(A&gt;100) 

B=rand(1,20);
w=find(B&lt;0.4,2) //at most 2 returned values

H=rand(4,3,5); //an hypermatrix
[i,j,k]=find(H&gt;0.9)  

H(i(1),j(1),k(1))
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="boolean.htm">
        <tt>
          <b>boolean</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="extraction.htm">
        <tt>
          <b>extraction</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="insertion.htm">
        <tt>
          <b>insertion</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="../elementary/vectorfind.htm">
        <tt>
          <b>vectorfind</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
  </body>
</html>
